<?php

namespace App\Http\Requests\Api;

class CompanyRequest extends FormRequest
{
    public function rules()
    {
        switch($this->method()) {

            case 'POST':
                return [
                    'name' => 'required|string',
                    'logo' => 'required|string',
                    'area_id' => 'required|exists:areas,id',
                ];
                break;

            case 'PATCH':
                return [
                    'name' => 'string',
                    'logo' => 'string',
                    'area_id' => 'exists:areas,id',
                ];
                break;
        }
    }

    public function attributes()
    {
        return [
            'name' => '商家名称',
            'logo' => '商家缩略图',
            'area_id' => '区域',
        ];
    }
}
